#pragma  once

#include "base/core/singleton.h"
#include "base/core/object_pool.h"
#include "Common/MessageDispatch/IMessageDispatch.h"

class WebCenterMgr : public ManualSingleton<WebCenterMgr>,
					 public IServerMessageHandler,
					 public IClientMessageHandler

{
public:
	typedef bool(WebCenterMgr::*pFunc)(RECV_PACKAGE &package);
	typedef unordered_map<uint32_t, pFunc> mFunc;

	WebCenterMgr();
	virtual ~WebCenterMgr();

	bool				Init();
	bool				UnInit();
public:
	virtual void		onServerMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getServerHandlerDebugInfo(void) { return nullptr; };

	virtual void		onClientMessage(uint32_t actionId, RECV_PACKAGE &package, uint64_t Id = 0);
	virtual const char* getClientHandlerDebugInfo(void) { return NULL; };
protected:
	bool WebGM(RECV_PACKAGE& package);
	bool WebGMResultFromLogic(RECV_PACKAGE& package);

	bool WebMail(RECV_PACKAGE& package);

	bool WebRumor(RECV_PACKAGE& package);

	bool OpWebRigsterRsp(RECV_PACKAGE& package);

	bool SynWebOpInfo(RECV_PACKAGE& package);

	bool WebOpOpenReq(RECV_PACKAGE& package);

	bool WebOpSortReq(RECV_PACKAGE& package);

	bool WebCdKeyReqFromClient(RECV_PACKAGE& package);
	bool WebCdKeyRspFromWeb(RECV_PACKAGE& package);

private:
	mFunc m_Func;
};



#define g_MakeWebCenterMgr() (WebCenterMgr::Instance())
#define g_GetWebCenterMgr()  (WebCenterMgr::GetInstance())
#define g_DelWebCenterMgr()  (WebCenterMgr::Destroy())
